import { hasOwnProperty } from "./utils"

export let config = {
  mergeOptionsConfig: Object.create(null)
}

export function defaultStrat(parentVal, childVal) {
  return parentVal === undefined ? childVal : parentVal
}

// mixin先放着，因为我看到extend就是mergeDataOrFn方法
export const strats = config.mergeOptionsConfig

// 此纯为我自己实现，可能有不足
strats.data = function (parentVal, childVal, vm) {
  if (isFunction(parentVal)) {
    parentVal = parentVal.call(vm)
  }
  if (isFunction(childVal)) {
    childVal = childVal.call(vm)
  }
  for (key in childVal) {
    defaultStrat(parentVal[key], childVal[key])
  }
}

strats.computed = function () {

}